package com.novoda.runbuddy.provider;

import java.util.Map;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.util.Log;

public class RunsProvider extends IRBContentProvider {

	private static final String	TAG	=  RunsProvider.class.getName();;
	private static Map<String, String>	RUN_LIST_PROJECTION_MAP		= null;

	public RunsProvider(ContentProvider cp, SQLiteOpenHelper mOpenHelper) {
		super(cp, mOpenHelper);
	}
	public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
return null;
//		SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
//		Cursor c = null;
//
//		int match = URI_MATCHER.match(uri);
//		switch (match) {
//			case RUNS:
//				Log.d(TAG, "Query : [" + uri.getQuery() +" ] for URI [" +uri +"]");
//				String fromDate =  uri.getQueryParameter("from");
//				String toDate =  uri.getQueryParameter("to");
//				
//				if(fromDate == null & toDate == null){
//					c = mDB.rawQuery(RunDBSQL.GET_ALL_RUN_ENTRIES, null);
//				}else{
//					Log.i(TAG, "The query to be used for in between is: " + RunDBSQL.GET_RUN_ENTRIES_BETWEEN_ISO_DATES(fromDate, toDate));
//					c = mDB.rawQuery(RunDBSQL.GET_RUN_ENTRIES_BETWEEN_ISO_DATES(fromDate, toDate), null);
//				}				
//				break;
//			default:
//				throw new IllegalArgumentException("Unknown URL " + uri);
//		}
//
//		c.setNotificationUri(getContext().getContentResolver(), uri);
//		return c;
	}	
	
//	public ListOfRuns fetchAllRunEntries() {
//		ListOfRuns ret = new ListOfRuns();
//		Cursor c = db.query(RunDBSQL.RUNNING_ENTRIES_TABLE, RunDBSQL.COLUMNS_IN_RUN_ENTRY, null, null, null, null, null);
//		Cursor c2 = db.query(RunDBSQL.RUNSEGMENT_ENTRIES_TABLE, RunDBSQL.COLUMNS_IN_RUNSEGMENT_ENTRY, null, null, null, null, null);
//		
//		int numRows = c.count();
//		c.first();
//		for (int i = 0; i < numRows; ++i) {
//			
//			int runId = c.getInt(0);
//			int routeId = c.getInt(1);
//			String runName = c.getString(2);
//			long runTotalTime = c.getLong(3);
//			long runCreationTime = c.getLong(4);
//			int geoId = 0;
//			int route_sid = 0;
//			
//			LinkedList<RunSegment> runSegments = new LinkedList<RunSegment>();
//			
//			
//			//for the number of runSegments for the run
//			//add the run Segments to the list
//
//			
//			Route route = new Route(routeId, route_sid, geoId, runName, null, runCreationTime);
//			
//			ret.add(new Run(runId, route, runName, runSegments, runTotalTime, runCreationTime));
//			c.next();
//		}
//
//		return ret;
//	}
	
	
	
	
	
	
	
	
	
	
	
	
	

	@Override
	public int delete(Uri arg0, String arg1, String[] arg2) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getType(Uri arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Uri insert(Uri arg0, ContentValues arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
		// TODO Auto-generated method stub
		return 0;
	}

}
